<%@ include file="/common/taglibs.jsp"%>
<%@ page language="java" pageEncoding="utf8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"
	dir="ltr">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<link rel="stylesheet" href="<c:url value="/css/shopadmin.css"/>"
			type="text/css" />
		<link rel="stylesheet"
			href="<c:url value='/scripts/themes/base/jquery.ui.all.css'/>"
			type="text/css" />


	</head>
	<body>
		<div id="headBar" class="head_content">
			<div class="finder-action" id="finder-action-d45cee">
				<div class="finder-action-inner clearfix">
					<form class="finder-search" action="mt_gift_list.html">
						<div class="finder-search-inner">
							<input class="imgbundle finder-search-btn"
								src="<c:url value="/images/transparent.gif"/>" tag="input"
								style="width: 19px; height: 17px; background-position: 0pt -668px;"
								type="image">
							<span class="finder-search-select "><label>
									赠品名称
								</label> <img src="<c:url value="/images/transparent.gif"/>"
									class="imgbundle"
									style="width: 7px; height: 5px; background-position: 0pt -48px;">
							</span>
							<input class="finder-search-input" name="giftName"
								value="${giftName}" size="20" maxlength="40" type="text">
						</div>
					</form>

					<button type="button" wrapimg="true"
						onclick="location.href = 'mt_gift_add.html'"   class="btn btn-large">
						<span><span><i class="finder-icon"><img
										src="<c:url value="/images/transparent.gif"/>"
										class="imgbundle icon"
										style="width: 24px; height: 24px; background-position: 0pt -316px;">
							</i>添加赠品</span> </span>
					</button>
					<button type="button" onclick=location.reload();  class="btn">
						<span><span><i class="finder-icon"><img
										src="<c:url value="/images/transparent.gif"/>"
										class="imgbundle icon"
										style="width: 22px; height: 24px; background-position: 0pt -644px;">
							</i>刷新</span> </span>
					</button>
					<button type="button" class="btn" onclick="giftBatchDelete()">
						<span><span><i class="finder-icon"><img
										src="<c:url value="/images/transparent.gif"/>"
										class="imgbundle icon"
										style="width: 17px; height: 24px; background-position: 0pt -757px;">
							</i>删除</span> </span>
					</button>
				</div>
			</div>

			<div id="finder-header-d45cee" class="finder-header">

				<table cellpadding="0" cellspacing="0" width="100%">
					<!----cols---->
					<col style="width: 24px;" class="span-select" />
					<col style="width: 70px;" />
					<col style="width: 230px;" />
					<col style="width: 110px;" />
					<col style="width: 75px;" />
					<col style="width: 75px;" />
					<col style="width: 100px;" />
					<col style="width: 50px;" />
					<col style="width: 50px;" />
					<col style="width: 50px;" />
					<col style="width: 110px;" />
					<col />
					<!----cols---->
					<thead>
						<tr>
							<td>
								<input class="sellist" id="gift_ids" type="checkbox" />
							</td>
							<td>
								<table cellpadding="0" cellspacing="0" width="100%">
									<tbody>
										<tr>
											<td>
												<span class="finder-col-label">操作</span>
											</td>
										</tr>
									</tbody>
								</table>
							</td>
							<td>
								<div class="cell " key="name">
									<table cellpadding="0" cellspacing="0" width="100%">
										<tbody>
											<tr>
												<td>
													<span class="finder-col-label">赠品名称</span>
												</td>
											</tr>
										</tbody>
									</table>
								</div>
							</td>
							<td>
								<div class="cell " key="giftcat_id">
									<table cellpadding="0" cellspacing="0" width="100%">
										<tbody>
											<tr>
												<td>
													<span class="finder-col-label">分类</span>
												</td>
											</tr>
										</tbody>
									</table>
								</div>
							</td>
							<td>
								<div class="cell " key="limit_start_time">
									<table cellpadding="0" cellspacing="0" width="100%">
										<tbody>
											<tr>
												<td>
													<span class="finder-col-label">开始时间</span>
												</td>
											</tr>
										</tbody>
									</table>
								</div>
							</td>
							<td>
								<div class="cell " key="limit_end_time">
									<table cellpadding="0" cellspacing="0" width="100%">
										<tbody>
											<tr>
												<td>
													<span class="finder-col-label">结束时间</span>
												</td>
											</tr>
										</tbody>
									</table>
								</div>
							</td>
							<td>
								<div class="cell " key="point">
									<table cellpadding="0" cellspacing="0" width="100%">
										<tbody>
											<tr>
												<td>
													<span class="finder-col-label">兑换所需积分</span>
												</td>
											</tr>
										</tbody>
									</table>
								</div>
							</td>
							<td>
								<div class="cell " key="storage">
									<table cellpadding="0" cellspacing="0" width="100%">
										<tbody>
											<tr>
												<td>
													<span class="finder-col-label">库存</span>
												</td>
											</tr>
										</tbody>
									</table>
								</div>
							</td>
							<td>
								<div class="cell " key="shop_iffb">
									<table cellpadding="0" cellspacing="0" width="100%">
										<tbody>
											<tr>
												<td>
													<span class="finder-col-label">发布</span>
												</td>
											</tr>
										</tbody>
									</table>
								</div>
							</td>

							<td>
								<div class="cell " key="ifrecommend">
									<table cellpadding="0" cellspacing="0" width="100%">
										<tbody>
											<tr>
												<td>
													<span class="finder-col-label">推荐</span>
												</td>
											</tr>
										</tbody>
									</table>
								</div>
							</td>
							<td>
								<div class="cell " key="limit_num">
									<table cellpadding="0" cellspacing="0" width="100%">
										<tbody>
											<tr>
												<td>
													<span class="finder-col-label">限购数量</span>
												</td>
											</tr>
										</tbody>
									</table>
								</div>
							</td>
							<td>
								&nbsp;
							</td>
						</tr>
					</thead>
				</table>
			</div>
		</div>
		<div id="main" class="main_content">
			<div class="finder-list finder-list-normal">
				<form id="gift_list_form" action="mt_gift_delete.html" method="post">
					<table id="gift_tbl" cellpadding="0" cellspacing="0" width="100%">
						<!----cols---->
						<col style="width: 24px;" class="span-select" />
						<col style="width: 70px;" />
						<col style="width: 230px;" />
						<col style="width: 110px;" />
						<col style="width: 75px;" />
						<col style="width: 75px;" />
						<col style="width: 100px;" />
						<col style="width: 50px;" />
						<col style="width: 50px;" />
						<col style="width: 50px;" />
						<col style="width: 110px;" />
						<col />
						<!----cols---->
						<tbody>
							<c:forEach var="gift" items="${marketGifts}"
								varStatus="giftIndex">
								<tr class="row" item-id="4">
									<td>
										<input onclick='changeColor(this)' class="sel"
											name="marketGifts[${giftIndex.index}].giftId"
											value="${gift.giftId}" type="checkbox" />
									</td>
									<td key="_cmd">
										<div class="cell">
											<a href="mt_gift_edit.html?giftId=${gift.giftId}"><img
													src="<c:url value="/images/transparent.gif"/>"
													class="imgbundle"
													style="width: 15px; height: 16px; background-position: 0pt -133px;">
													编辑 
											</a>
										</div>
									</td>
									<td key="name" class="editable">
										<div class="cell">
											${gift.name}
										</div>
									</td>
									<td key="giftcat_id" class="editable">
										<div class="cell">
											${gift.giftCatId}
										</div>
									</td>
									<td key="limit_start_time">
										<div class="cell">
											${gift.limitStartTimeString}
										</div>
									</td>
									<td key="limit_end_time">
										<div class="cell">
											${gift.limitEndTimeString}
										</div>
									</td>
									<td key="point" class="editable">
										<div class="cell">
											${gift.point}
										</div>
									</td>
									<td key="storage" class="editable">
										<div class="cell">
											${gift.storage}
										</div>
									</td>
									<td key="shop_iffb">
										<div class="cell">

											<c:if test="${gift.showOn}">是</c:if>
											<c:if test="${!gift.showOn}">否</c:if>
										</div>
									</td>
									<td key="ifrecommend" class="editable">
										<div class="cell">

											<c:if test="${gift.recommendOn}">是</c:if>
											<c:if test="${!gift.recommendOn}">否</c:if>
										</div>
									</td>
									<td key="limit_num" class="editable">
										<div class="cell">
											${gift.limitNum}
										</div>
									</td>
									<td>
										&nbsp;
									</td>
								</tr>
							</c:forEach>
						</tbody>
					</table>
				</form>
			</div>


		</div>
		<div id="footBar" class="foot_content">
			<div class="finder-footer" id="finder-footer-ea2899">
				<div class="finder-page clearfix">
					<div class="span-3">

					</div>
					<div class="span-auto">
						${pagerString}
					</div>
					<div class="span-auto textright">
						共
						<i>${fn:length(marketGifts)}</i>条
					</div>
				</div>
			</div>

		</div>



		<script type="text/javascript"
			src="<c:url value='/scripts/jquery-1.4.2.js'/>"></script>
		<%@ include file="/jsp/admin/common/messages.jsp"%>


		<script type="text/javascript">
	var selected = 'selected';
	$("#gift_ids").click(function() {

		if (this.checked) {
			$('input[type=checkbox]').attr("checked", true);

			$('#gift_tbl >tbody> tr').addClass(selected);
		} else {
			$('input[type=checkbox]').attr("checked", false);
			$('#gift_tbl > tbody > tr').removeClass(selected);
		}
	});

	function changeColor(obj) {
		if ($(obj).attr("checked")) {
			$(obj).parent().parent().addClass(selected);
		} else {
			$(obj).parent().parent().removeClass(selected);
		}
	}

	function giftBatchDelete() {
		var selected = false;
		$('#gift_tbl input[type=checkbox]').each(function(i, dom) {
			if ($(dom).attr("checked")) {
				selected = true;
			}
		});
		if (!selected) {
			alert('请选择要删除的赠品');
			return;
		}
		if (!confirm("确定删除吗？")) {
			return;
		}
		$('#gift_list_form').submit();
	}
</script>


	</body>


</html>

